]> dgit.raspbian.org Git - ostree.git/commit
tests: Respect TEST_TMPDIR for temporary directories
authorIgor Opaniuk <igor.opaniuk@foundries.io>
Mon, 9 Mar 2026 11:04:07 +0000 (12:04 +0100)
committerIgor Opaniuk <igor.opaniuk@foundries.io>
Mon, 16 Mar 2026 14:26:16 +0000 (15:26 +0100)
commite2f583f56a57d024db54e501829122abd4ff531d
treee6f59e0d938ffc0f2dca3642659b638057b10d87
parent8bfd92993e0ee3a213888006171b1b4fa6eb2ade
tests: Respect TEST_TMPDIR for temporary directories

Several C tests hardcoded /var/tmp as the base path for temporary
working directories, ignoring the TEST_TMPDIR environment variable
used by the shell test suite.

This caused tests to create their ostree repos on the overlayfs
filesystem even when TEST_TMPDIR points to a real filesystem,
bypassing the intended workaround for overlayfs's inaccurate
free-space reporting. As a result, ostree's min-free-space-percent
check (default 3%) would fire when writing content objects, making
tests fail in containerized environments where the rootfs is overlayfs.

Fix by reading TEST_TMPDIR at runtime and falling back to /var/tmp
when it is not set, consistent with how the shell test suite handles
this. Affected tests:
- tests/test-libarchive-import.c
- tests/test-basic-c.c

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
tests/libostreetest.c
tests/libostreetest.h
tests/test-basic-c.c
tests/test-libarchive-import.c